Many computer graphic images are created by mathematically modeling the interaction of light with a three dimensional scene from a given viewpoint. This process, called rendering, generates a two-dimensional image of the scene from the given viewpoint, and is analogous to taking a photograph of a real-world scene. Animated sequences can be created by rendering a sequence of images of a scene as the scene is gradually changed over time. A great deal of effort has been devoted to making realistic looking rendered images and animations.
In typical shader languages, a user programmer can use surface attribute functions to define the values of attributes of surfaces in three-dimensional space. Such surface attribute functions can be evaluated at any point on the surface to provide corresponding attribute values at that point on the surface. Attributes of surfaces can include optical properties of a surface, such as color, transparency, reflectivity, and refractivity. Attributes can also include visibility or occlusion information; artistically or procedurally generated texture data in one, two, three, or more dimensions; shadow generation information; illumination information, which specifies the amount and direction of light on the surface point from other portions of the scene; and rendering information, such as ray tracing path information or radiosity rendering information. Functions can be relatively simple, such as looking up texture data from a texture map, or very complex, such as the evaluation of complex user-defined shader programs, ray tracing programs, animation or modeling programs, or simulation programs.
There are some problems with most existing rendering processes, such as visual complexity, motion blur, speed and memory limitation. In particular, the process of rendering an image or frame of animation can be a very time-consuming process. Thus, computations in a shader are analyzed to find a way to reduce the rendering time. One conventional technique may be pipelining shader operations on each data point in a grid, using parallel processing or the like, thereby saving computation time and increasing cache efficiency. However, some shader operations should be implemented on data points in a certain order and thus cannot be processed in a parallel process manner. For example, if a calculation on a data point “A” depends on a result of another calculation on another data point “B”, such calculations need to be implemented in a specified order. Further, the result of the calculation on the data point “B” occupies cache or memory space for some time since the result cannot be discarded until the data point A is subsequently calculated. If such a calculation is included in a shader, other calculations in the shader need to be implemented on data points in the specified order for an accurate calculation. This consumes unnecessarily large cache space and slows the rendering process down.
Accordingly, what is desired are improved methods and apparatus for solving some of the problems discussed above. Additionally, what is desired are improved methods and apparatus for reducing some of the drawbacks discussed above.